class Parse:

    @staticmethod
    def file2name_suffix(filename):
        if "." in filename:
            # 拆分文件名称和后缀名
            start_index = filename.rindex('.')
            file_name = filename[:start_index]
            file_suffix = f".{filename[start_index + 1:]}"
        else:
            # 文件无后缀名,流文件校验
            file_suffix = ""
            file_name = filename
        return file_name,file_suffix

    @staticmethod
    def verify_dir(suffix,path_config:dict):
        dirname = None
        for k,v in path_config.items():
            if suffix in v:
                dirname = k
                break
        return dirname

